import { defineStore } from 'pinia';
import { ref } from 'vue';
import type { CommandSender } from '../commandHelper';

type SendDeviceCmd = CommandSender<any, any> | null;

// 1. 先按原来的方式定义Store（完全不变）
export const useDeviceStore = defineStore('deviceInjection', () => {
  const sendDeviceCmd = ref<SendDeviceCmd>(null);

  const setInjections = (injections: { sendDeviceCmd?: SendDeviceCmd }) => {
    if (injections.sendDeviceCmd) {
      sendDeviceCmd.value = injections.sendDeviceCmd;
    }
  };

  return { sendDeviceCmd, setInjections };

});